<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form" %>
<%--
  Created by IntelliJ IDEA.
  User: Server
  Date: 2015/5/23
  Time: 14:55
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <meta name="_csrf" content="${_csrf.token}"/>
    <meta name="_csrf_header" content="${_csrf.headerName}"/>
    <script type="text/javascript" src="../../js/jquery-1.9.1.js"></script>
    <title></title>
    <script type="text/javascript">

        i = 1;
        j = 1;
        $(document).ready(function(){

            $("#btn_add2").click(function(){

                document.getElementById("newUpload2").innerHTML+='<div id="div_'+j+'"><input  name="file_'+j+'" type="file"  /><input type="button" value="删除"  onclick="del_2('+j+')"/></div>';
                j = j + 1;
            });
        });



        function del_2(o){
            document.getElementById("newUpload2").removeChild(document.getElementById("div_"+o));
        }

    </script>

<body>

<h2>上传多个文件 实例</h2>
<form:form action="/admin/fileUpload?${_csrf.parameterName}=${_csrf.token}" method="post"
           enctype="multipart/form-data">
    <div id="newUpload2">
        <input type="file" name="file">
    </div>
    <input type="button" id="btn_add2" value="增加一行" >
    <input type="submit" value="上传" >
</form:form>

</body>
</html>
